﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using testy;

namespace testttt {
	public partial class Form1 : Form {
		TextBox aaa;
		public Form1 () {
			InitializeComponent();
		}
		private void Form1_Load (object sender, EventArgs e) {
			/*List<Question> qs = new List<Question>();
			List<Answer> ans1 = new List<Answer>();
			ans1.Add(new Answer("ala", 1.2, true));
			ans1.Add(new Answer("ma", 2.4, false));
			ans1.Add(new Answer("kota", 2, true));
			qs.Add(new Question("Jakie zdanie?", ans1, true, 2));
			List<Answer> ans2 = new List<Answer>();
			ans2.Add(new Answer("jabłko", 1.2, true));
			ans2.Add(new Answer("banan", 2.4, false));
			ans2.Add(new Answer("marchew", 2, true));
			qs.Add(new Question("Co lubisz?", ans2, false, 0));
			List<Answer> ans3 = new List<Answer>();
			ans3.Add(new Answer("Zdzichu", 1.2, true));
			ans3.Add(new Answer("Rychu", 2.4, false));
			ans3.Add(new Answer("Krzychu", 2, true));
			qs.Add(new Question("Kto jest winny?", ans3, true, 0));
			Test t = new Test("Test nad testy", qs, 30);*/
			try {
				Test t = new Test(@"X:\programowanie obiektowe i graficzne\testy\test.tst");
				t.saveToFile(@"X:\programowanie obiektowe i graficzne\testy\test.tst");
				this.aaa = new TextBox();
				this.aaa.Location = new System.Drawing.Point(141, 75);
				this.aaa.Name = "aaa";
				this.aaa.Text = t.generateXML();
				this.aaa.Size = new System.Drawing.Size(300, 40);
				this.aaa.Multiline = true;
				this.aaa.TabIndex = 0;
				this.Controls.Add(aaa);
			} catch (Exception ex) {
				MessageBox.Show(ex.Message);
			}
		}

		private void button1_Click (object sender, EventArgs e) {
			if (this.Controls.Contains(this.aaa)) {
				this.Controls.Remove(this.aaa);
			} else {
				this.Controls.Add(this.aaa);
			}
		}
	}
}
